package com.ht.api.db.task;

import java.util.Random;

import org.springframework.stereotype.Component;

import com.ht.api.db.exception.HtException;

import cn.hutool.json.JSONObject;
import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class DemoTaskHandler implements TaskHandler{

	@Override
	public String getName() {
		return "taskDemo";
	}

	@Override
	public boolean handler(JSONObject requestParam, String groupId, long taskId) {
		System.err.println("111111");
		int r = new Random().nextInt(10);
		if (r >= 7) {
			throw new HtException("模拟异常");
		}
//		if (r >= 5) {
//			return false;
//		}
		return true;
	}

}
